import vueRouter from '@/router'
import axios from './index'

const getAppId = () => {
    const route = vueRouter?.currentRoute?.value
    return route.params.appId || ''
}

/**
 * @description 获取预约/互动页面个性化设计详情
 * @param {String} type 模块类型
 * @param {String} id 模块ID
 */
 export const getPageSettingDetail = (dataObj = { type, id }) => axios.request({
    url: '/appAdmin/GetPageSettingDetail',
    data: Object.entries(dataObj).map(([key, value]) => `${key}=${value}&`).join(''),
    method: 'post'
})

/**
 * @description 保存预约/互动页面个性化设计
 * @param {String} type 模块类型
 * @param {String} id 模块ID
 * @param {String} extend_json 个性化数据
 */
 export const savePageSetting = (dataObj = { type, id, extend_json }) => axios.request({
    url: '/appAdmin/PageSetting',
    data: Object.entries(dataObj).map(([key, value]) => `${key}=${value}&`).join(''),
    method: 'post'
})